package com.xveshe.admin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xveshe.common.annotation.Log;
import com.xveshe.common.core.controller.BaseController;
import com.xveshe.common.core.domain.AjaxResult;
import com.xveshe.common.enums.BusinessType;
import com.xveshe.admin.domain.XsglGxhGjgs;
import com.xveshe.admin.service.IXsglGxhGjgsService;
import com.xveshe.common.utils.poi.ExcelUtil;
import com.xveshe.common.core.page.TableDataInfo;

/**
 * 岗级岗时个性化设置Controller
 *
 * @author geyasong
 * @date 2024-11-05
 */
@RestController
@RequestMapping("/admin/gjgs")
public class XsglGxhGjgsController extends BaseController
{
    @Autowired
    private IXsglGxhGjgsService xsglGxhGjgsService;

    /**
     * 查询岗级岗时个性化设置列表
     */
    @GetMapping("/list")
    public TableDataInfo list(XsglGxhGjgs xsglGxhGjgs)
    {
        startPage();
        List<XsglGxhGjgs> list = xsglGxhGjgsService.selectXsglGxhGjgsList(xsglGxhGjgs);
        return getDataTable(list);
    }

    /**
     * 导出岗级岗时个性化设置列表
     */
    @PreAuthorize("@ss.hasPermi('admin:gjgs:export')")
    @Log(title = "岗级岗时个性化设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, XsglGxhGjgs xsglGxhGjgs)
    {
        List<XsglGxhGjgs> list = xsglGxhGjgsService.selectXsglGxhGjgsList(xsglGxhGjgs);
        ExcelUtil<XsglGxhGjgs> util = new ExcelUtil<XsglGxhGjgs>(XsglGxhGjgs.class);
        util.exportExcel(response, list, "岗级岗时个性化设置数据");
    }

    /**
     * 获取岗级岗时个性化设置详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(xsglGxhGjgsService.selectXsglGxhGjgsById(id));
    }

    /**
     * 新增岗级岗时个性化设置
     */
    @PreAuthorize("@ss.hasPermi('admin:gjgs:add')")
    @Log(title = "岗级岗时个性化设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody XsglGxhGjgs xsglGxhGjgs)
    {
        return toAjax(xsglGxhGjgsService.insertXsglGxhGjgs(xsglGxhGjgs));
    }

    /**
     * 修改岗级岗时个性化设置
     */
    @PreAuthorize("@ss.hasPermi('admin:gjgs:edit')")
    @Log(title = "岗级岗时个性化设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody XsglGxhGjgs xsglGxhGjgs)
    {
        return toAjax(xsglGxhGjgsService.updateXsglGxhGjgs(xsglGxhGjgs));
    }

    /**
     * 删除岗级岗时个性化设置
     */
    @PreAuthorize("@ss.hasPermi('admin:gjgs:remove')")
    @Log(title = "岗级岗时个性化设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(xsglGxhGjgsService.deleteXsglGxhGjgsByIds(ids));
    }
}
